package com.mes.cloud.web;

import com.mes.cloud.api.dto.request.organization.SysOrganizationChannelRequest;
import com.mes.cloud.api.dto.response.organization.SysOrganizationChannelDto;
import com.mes.cloud.common.JsonResult;
import com.mes.cloud.service.SysOrganizationChannelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @author ysd
 * @email shaodong.yuan@pactera.com
 * @version 2019-08-30 13:36:07
 */
@Api(tags = "组织渠道中间表", value = "组织渠道中间表接口")
@RestController
@RequestMapping(value = "/sysOrganizationChannel")
public class SysOrganizationChannelController  {

    private SysOrganizationChannelService sysOrganizationChannelService;

    @Autowired
    public SysOrganizationChannelController(SysOrganizationChannelService sysOrganizationChannelService) {
        this.sysOrganizationChannelService = sysOrganizationChannelService;
    }

    /**
     * 功能: 组织渠道中间表查询所有
     *
     * @param sysOrganizationChannelRequest
     * @return JsonResult<List<SysOrganizationChannelDto>>
     */
    @ApiOperation(value = "组织渠道中间表查询所有", notes = "组织渠道中间表查询所有")
    @PostMapping(value = "/list")
    public JsonResult<List<SysOrganizationChannelDto>> list(@RequestBody SysOrganizationChannelRequest sysOrganizationChannelRequest) {
        return  sysOrganizationChannelService.list(sysOrganizationChannelRequest);
    }

    /**
     * 功能: 组织渠道中间表新增
     *
     * @param sysOrganizationChannelRequest
     * @return JsonResult
     */
    @ApiOperation(value = "组织渠道中间表新增", notes = "组织渠道中间表新增")
    @PostMapping(value = "/add")
    public JsonResult add(@Valid @RequestBody SysOrganizationChannelRequest sysOrganizationChannelRequest) {
        return sysOrganizationChannelService.add(sysOrganizationChannelRequest);
    }
}
